<include file="public@header" />
<style>
    .form-group{ color:#999}
    .minwidth{width:52px !important}

    .w70{
        width: 70px!important;
    }
    .w80{
        width: 80px!important;
    }
    .w100{
        width: 100px!important;}
    .cailiao .col-md-2{
        padding-left:0;
        padding-right:0;
    }
</style>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('visua/index')}">{:lang('ADMIN_VISUA_INDEX')}</a></li>
        <li class="active"><a href="">{:lang('ADMIN_TOMBAREA_INFORMATION')}</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form" id="ajax-form" action="{:url('')}" style="width:100%; float:left">
        <div class="row">
            <div class="p_title" style="margin: -9px 0 10px 0px;">
                <span class="span_title">墓位信息</span>
            </div>
            <div class="col-lg-10 control-group1-p" style="margin: 0 0 0 15px; padding: 15px 0 0 0;width: 85%;">
                <input type="hidden" class="form-control" name="col_id" value="{$col_id}" >
                <input type="hidden" class="form-control" name="selected_id_v" value="{$selected_id_v}" >
                <input type="hidden" class="form-control" name="id" value="{$result.id|default=''}" >
                <input type="hidden" class="form-control" name="tomb_region" value="{$result.tomb_region|default=''}" >
                <div  class="form-group" >
                    <label class="control-label">状态：</label>
                    <div class="col-md-2">
                        <select class="form-control" name="pro_status">
                            <option value="1">启用</option>
                        </select>
                    </div>
                    <label class="control-label w100">墓位编号：</label>
                    <div class="col-md-7">
                        <input type="text" disabled  style="width: 100%" class="form-control"  value="{$num_sn}" >
                    </div>
                </div>
                <!--<if condition="$cate_id eq 1"> 商品葬-->
                <fieldset >
                    <div class="form-group" >
                        <label class="control-label">葬式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="funeral" >
                                <foreach name="tomb_funeral.sp" item="vo">
                                    <if condition="isset($result['funeral'])">
                                        <option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100" >占地长度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="footprint" id="footprint" style="width: 100px;" value="{$result.footprint|default=''}" >mm
                        </div>
                        <label class="control-label w100" >占地宽度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="tombstone_w" id="tombstone_w" style="width: 100px;"value="{$result.tombstone_w|default=''}" >mm
                        </div>
                        <label class="control-label w100" >墓碑高度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="tombstone_h" id="tombstone_h"style="width: 100px;"value="{$result.tombstone_h|default=''}" >mm
                        </div>
                    </div>
                    <div class="form-group"  >
                        <label class="control-label">墓穴规制：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="tomb_regulation" >
                                <foreach name="tomb_regulation" item="vo">
                                    <if condition="isset($result['tomb_regulation'])">
                                        <option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
                                        <else />
                                        <option value="{$vo.id}" >{$vo.name}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100"  >收敛形式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="convergence" >
                                <foreach name="tomb_convergence.sp" item="vo">
                                    <if condition="isset($result['convergence']) ">
                                        <option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>

                            </select>
                        </div>
                        <label class="control-label w100" >单穴最大尺寸：</label>
                        <div class="col-md-2">
                            <input type="hidden"  name="sc_width" value="400" >
                            <input type="hidden"  name="sc_height" value="400">
                            <input type="hidden"  name="sc_thick" value="400">
                            <input type="text" class="form-control" disabled value="400*400*400" style="width: 130px;" > mm
                        </div>
                        <label class="control-label w100">拜道规格：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control " name="specifications"style="width: 120px;" placeholder="长*宽" value="{$result.specifications|default='10*10'}" > mm
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label ">绿化带规格：</label>
                        <div class="col-md-2"  >
                            <input type="text" class="form-control " name="green_belt" style="width: 130px"   placeholder="长*宽" value="{$result.green_belt|default='10*10'}" > mm
                        </div>
                        <label class="control-label w100">绿化带数量：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control " name="greenbelt_num" placeholder="数量" value="{$result.greenbelt_num|default='1'}" >
                        </div>
                        <label class="control-label w100" >售后质保期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="warranty" >
                                <option value="3" >购买起计3年</option>
                            </select>
                        </div>
                        <label class="control-label w100">墓穴维护期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="maintain" >
                                <option value="20" >首位安葬起20年</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label ">抵顶人：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="substitute">
                                <option value="">无</option>
                                <foreach name="didingList" item="vo">
                                    <if condition="isset($result['substitute'])">
                                        <option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
                                        <else/>
                                        <option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">类型：</label>
                        <div class="col-md-2">
                            <input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
                            <select class="form-control"  disabled >
                                <option value="1"  >商品墓</option>
                            </select>
                        </div>
                        <label class="control-label w100">销售价格：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:100px">
                            <select class="form-control" name="menu_type" style="width:70px">
                                <option value="套" >套</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label w100" style="margin-left: 30px;">匹配碑型：</label>
                        <div class="col-md-3">
                            <select id="mb_id" class="form-control" name="new_pro" >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <if condition="isset($result['new_pro'])">
                                        <option value="{$vo.id}"  data-photo="{$vo.pro_photo}" data-pro_length="{$vo.pro_length}" data-pro_width="{$vo.pro_width}" data-pro_height="{$vo.pro_height}" data-photo_path="{$vo.pro_photo_path}" <if condition="$vo.id eq  $result['new_pro'] "> selected </if>>{$vo.pro_name} </option>
                                        <else/>
                                        <option value="{$vo.id}" data-pro_length="{$vo.pro_length}" data-pro_width="{$vo.pro_width}" data-pro_height="{$vo.pro_height}" data-photo="{$vo.pro_photo}" data-photo_path="{$vo.pro_photo_path}" >{$vo.pro_name}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label">以旧换新：</label>
                        <div class="col-md-3">
                            <input type="hidden" id="tom_img" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
                            <select  class="form-control" name="old_pro" >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <if condition="isset($result['old_pro'])">
                                        <option value="{$vo.id}"  data-photo="{$vo.pro_photo}" data-photo_path="{$vo.pro_photo_path}" <if condition="$vo.id eq  $result['old_pro'] ">selected </if>>{$vo.pro_name}</option>
                                        <else/>
                                        <option value="{$vo.id}"  data-photo="{$vo.pro_photo}" data-photo_path="{$vo.pro_photo_path}">{$vo.pro_name}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label ">备注：</label>
                        <div class="col-md-10">
                            <textarea type="text" class="form-control" rows="2" cols="65" style="width:600px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                        </div>
                    </div>
                </fieldset>
                <!--<elseif condition="$cate_id eq 2" /> 艺术墓-->
                <fieldset >
                    <div class="form-group" >
                        <label class="control-label">左右长度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" style="width:100px;" name="tombstone_h" value="{$result.tombstone_h|default=''}">
                        </div>
                        <label class="control-label" style="width: 100px">纵深宽度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" style="width:100px;" name="tombstone_w" value="{$result.tombstone_w|default=''}"> mm
                        </div>
                        <label class="control-label" style="width: 100px">占地面积：</label>
                        <div class="col-md-2"style="width: 17%;">
                            <input type="text" class="form-control" style="width:120px;"  name="footprint" value="{$result.footprint|default=''}" >m²
                            <input type="checkbox" name="is_bye" value="1"   <if condition="'1' eq isset($result['is_bye'])?$result['is_bye']:0">checked</if> >含拜道
                        </div>
                        <label class="control-label" style="width: 100px">设计墓穴：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="design" id="design">
                                <for start="0" end="6" step="1" >
                                    <if condition="isset($result['design'])">
                                        <option value="{$i}" <if condition="$i eq  $result['design']">selected </if>>{$i}套</option>
                                        <else/>
                                        <option value="{$i}">{$i}套</option>
                                    </if>
                                </for>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label">最高限制高程：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" style="width:100px;" name="limit_height" value="{$result.limit_height|default=''}">mm
                        </div>
                        <label class="control-label" style="width: 100px">外围设置：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="periphery">
                                <foreach name="tomb_periphery" item="vo">
                                    <if condition="isset($result['periphery']) ">
                                        <option value="{$vo}" <if condition="$vo eq  $result['periphery'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label" style="width: 100px">售后质保期：</label>
                        <div class="col-lg-2">
                            <select class="form-control" name="warranty" >
                                <option value="3" >购买起计3年</option>
                            </select>
                        </div>
                        <label class="control-label" style="width: 100px">墓穴维护期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="maintain" >
                                <option value="20" >首位安葬起20年</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">抵顶人：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="substitute">
                                <option value="">无</option>
                                <foreach name="didingList" item="vo">
                                    <if condition="isset($result['new_pro'])">
                                        <option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
                                        <else/>
                                        <option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label" style="width: 100px">类型：</label>
                        <div class="col-md-2">
                            <input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
                            <select class="form-control"  disabled >
                                <option >艺术墓</option>
                            </select>
                        </div>
                        <label class="control-label" style="width: 100px">销售价格：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:100px">
                            <select class="form-control" name="menu_type" style="width:100px">
                                <option value="平米" >元/平米</option>
                            </select>
                        </div>
                        <label class="control-label">档案号：</label>
                        <div class="col-md-2">
                            <input type="hidden" class="form-control" name="order_id" value="{$order_id|default=''}" >
                            <empty name="$archives_sn">
                                <input type="text" class="form-control" name="archives_sn" disabled value="{$archives_sn|default=''}" >
                                <else/>
                                <input type="text" class="form-control" name="archives_sn" value="{$archives_sn|default=''}" >
                            </empty>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label ">备注：</label>
                        <div class="col-md-10">
                            <textarea type="text" class="form-control" rows="2" cols="65" style="width:600px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                        </div>
                    </div>
                </fieldset>
                <!--<elseif condition="$cate_id eq 3" /> 生态墓-->
                <fieldset >
                    <div class="form-group">
                        <label class="control-label">壁式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="funeral" >

                                <foreach name="tomb_funeral.sp" item="vo">
                                    <if condition="isset($result['funeral'])">
                                        <option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">占地面积：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="footprint" value="{$result.footprint|default=''}" >m²
                        </div>
                        <label class="control-label w100">墓穴规制：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="tomb_regulation" >
                                <foreach name="tomb_regulation" item="vo">
                                    <if condition="isset($result['tomb_regulation'])?$result['tomb_regulation']:0 ">
                                        <option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
                                        <else/>
                                        <option value="{$vo.id}"  >{$vo.name}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">收敛形式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="convergence" >
                                <foreach name="tomb_convergence.st" item="vo">
                                    <if condition="isset($result['convergence']) ">
                                        <option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">售后质保期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="warranty" >
                                <option value="1" >购买起计3年</option>
                            </select>
                        </div>
                        <label class="control-label w100">墓穴维护期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="maintain" >
                                <option value="20" >首位安葬起20年</option>
                            </select>
                        </div>
                        <label class="control-label w100">抵顶人：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="substitute">
                                <option value="">无</option>
                                <foreach name="didingList" item="vo">
                                    <if condition="isset($result['new_pro'])">
                                        <option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
                                        <else/>
                                        <option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">类型：</label>
                        <div class="col-md-2">
                            <input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
                            <select class="form-control"  disabled >
                                <option >生态墓</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">销售价格：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:100px">
                            <input type="hidden" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
                            <select class="form-control" name="menu_type" style="width:80px">
                                <option value="套" >套</option>
                            </select>
                        </div>
                        <label class="control-label w100" >匹配碑型：</label>
                        <div class="col-md-2" style="width: 30%">
                            <select id="mb_id" class="form-control" name="new_pro"  >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <option value="{$vo.id}"  data-photo="{$vo.pro_photo}" data-pro_length="{$vo.pro_length}" data-pro_width="{$vo.pro_width}" data-pro_height="{$vo.pro_height}" data-photo_path="{$vo.pro_photo_path}" <if condition="$vo.id eq isset($result['new_pro'])?$result['new_pro']:0">selected</if>>{$vo.pro_name}</option>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">以旧换新：</label>
                        <div class="col-md-2">
                            <select  class="form-control" name="old_pro" >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <option value="{$vo.id}"  data-photo="{$vo.pro_photo}" data-photo_path="{$vo.pro_photo_path}" <if condition="$vo.id eq isset($result['old_pro'])?$result['old_pro']:0">selected</if>>{$vo.pro_name}</option>
                                </foreach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label ">备注：</label>
                        <div class="col-md-10">
                            <textarea type="text" class="form-control" rows="2" cols="65" style="width:600px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                        </div>
                    </div>
                </fieldset>
                <!--<elseif condition="$cate_id eq 4" /> 节地目 （寄存，壁墓）-->
                <fieldset >
                    <div class="form-group">
                        <label class="control-label">壁式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="funeral" >
                                <foreach name="tomb_funeral.jd" item="vo">
                                    <if condition="isset($result['funeral'])">
                                        <option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
                                        <else />
                                        <option value="{$vo}" >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">空间长度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="footprint" id="footprint" style="width: 100px;" value="{$result.footprint|default=''}" >mm
                        </div>
                        <label class="control-label w100">空间宽度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="tombstone_w" id="tombstone_w" style="width: 100px;"value="{$result.tombstone_w|default=''}" >mm
                        </div>
                        <label class="control-label w100">空间高度：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="tombstone_h" id="tombstone_h" style="width: 100px;"value="{$result.tombstone_h|default=''}" >mm
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">所在层数：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" name="layer_num" value="{$result.layer_num|default=''}" >
                        </div>
                        <label class="control-label w100">墓穴规制{:isset($result.tomb_regulation)}：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="tomb_regulation" >
                                <foreach name="tomb_regulation" item="vo">
                                    <if condition="isset($result['tomb_regulation'])">
                                        <option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
                                        <else/>
                                        <option value="{$vo.id}"  >{$vo.name}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">收敛形式：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="convergence" >
                                <foreach name="tomb_convergence.jd" item="vo">
                                    <if condition="isset($result['convergence'])">
                                        <option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
                                        <else/>
                                        <option value="{$vo}"  >{$vo}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">售后质保期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="warranty" >
                                <option value="3" >购买起计3年</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">墓穴维护期：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="maintain" >
                                <option value="20" >首位安葬起20年</option>
                            </select>
                        </div>
                        <label class="control-label w100">抵顶人：</label>
                        <div class="col-md-2">
                            <select class="form-control" name="substitute">
                                <option value="">无</option>
                                <foreach name="didingList" item="vo">
                                    <if condition="isset($result['new_pro'])">
                                        <option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
                                        <else/>
                                        <option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">类型：</label>
                        <div class="col-md-2">
                            <input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
                            <select class="form-control"  disabled >
                                <option >节地墓</option>
                            </select>
                        </div>
                        <label class="control-label w100">销售价格：</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:80px">
                            <select class="form-control" name="menu_type" style="width:120px">
                                <option value="套" >套</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label" >匹配碑型：</label>
                        <div class="col-md-2" style="width: 30%">
                            <input type="hidden" id="tom_img" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
                            <select id="mb_id" class="form-control" name="new_pro" >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <option value="{$vo.id}" data-photo_path="{$vo.pro_photo_path}"  data-pro_length="{$vo.pro_length}" data-pro_width="{$vo.pro_width}" data-pro_height="{$vo.pro_height}" <if condition="$vo.id eq isset($result['new_pro'])?$result['new_pro']:0">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label w100">以旧换新：</label>
                        <div class="col-md-2">
                            <select  class="form-control" name="old_pro" >
                                <option value="">请选择碑型</option>
                                <foreach name="mb_list" item="vo">
                                    <option value="{$vo.id}" <if condition="$vo.id eq isset($result['old_pro'])?$result['old_pro']:0">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
                                </foreach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label ">备注：</label>
                        <div class="col-md-10">
                            <textarea type="text" class="form-control" rows="2" cols="65" style="width:600px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                        </div>
                    </div>
                </fieldset>
                <!--</if>-->
            </div>
            <div class="col-md-2" style="padding: 0;;width: 13%;">
                <if condition="isset($result['tom_img'])">
                    <img src="{:cmf_get_image_preview_url($result.tom_img)}" class="preview" id="preview_path" style="max-width:200px; display:block; margin:0 auto;"/>
                    <eles />
                    <img  class="preview" id="preview_path" style="max-width:200px; display:block; margin:0 auto;"/>
                </if>
            </div>
        </div>
        </fieldset>
        <!--<if condition="$cate_id eq 2">-->
        <fieldset>
            <div class="row" style="margin: 0;">
                <div class="p_title">
                    <span class="span_title">墓碑信息</span>
                </div>
                <div class="col-lg-12 control-group1-p"  >
                    <div class="form-group">
                        <label class="control-label"  style="width: 150px">上传签章方案：</label>
                        <div class="controls">
                            <php>$img_urls=cmf_get_image_preview_url(isset($result['tom_img'])?$result['tom_img']:'');</php>
                            <input type="hidden" name="upload_plan" id="thumb" value="{$result.tom_img|default=''}">
                            <img src="{$img_urls}" id="thumb-preview" onclick="parent.imagePreviewDialog(this.src);"  width="36" style="cursor: hand"/>
                            <a href="javascript:uploadOneImage('图片上传','#thumb');">
                                <h5 class="btn btn-primary">上传</h5>
                            </a>
                            <!--                                <input type="button" class="btn btn-sm" onclick="$('#thumb-preview').attr('src','');$('#thumb').val('');return false;" value="取消图片">-->
                        </div>
                    </div>
                    <div id="mb">
                        <foreach name="$result.infoData" item="vo">
                            <div class="form-group push_add_mubs add_{$key}" data-key="{$key}"   data-mb_id="{$vo.mb_id}">
                                <input type='hidden' name='mb[{$key}][info_mb_id]' class="info_mb_id_{$key}" value='{$vo.id}'>
                                <input type='hidden' name='mb[{$key}][regulation]' class="regulation_{$key}" value='{$vo.regulation}'>
                                <input type="hidden" name="mb[{$key}][mb_id]" value="{$vo.mb_id}"  class="mb_id_{$key}">
                                <input type='hidden' class="dele_mb_id_{$key}" name='mb[{$key}][dele_info_mb_id]' value=''>
                                <label  class="control-label" style="width: 150px">
                                    【<input type="text" name="mb[{$key}][mb_name]" value="{$vo.mb_name}" class="mb_name_{$key}" style="width: 70px;border: 0" readonly="readonly">】</label>
                                <label style="margin-left: 15px">位置：
                                    <input type="text" name="mb[{$key}][address]" value="{$vo.address}"style="width: 180px;"  class="form-control" required>
                                </label>
                                <div class="btn btn-primary" style="margin-left: 30px">
                                    <a class="add_mub" data-mb_id="{$vo.mb_id}" id="add_mub_{$key}"   data-key="{$key}">
                                        <span style="color: #fff">编辑详细墓碑信息</span>
                                    </a>
                                </div>
                                    <div class="btn btn-danger" style="margin-left: 30px">
                                    <a class="del_mub" data-mb_id="{$vo.mb_id}" id="del_mub_{$key}"   data-key="{$key}">
                                        <span style="color: #fff">编辑详细墓碑信息</span>
                                    </a>
                                </div>
                            </div>
                        </foreach>
                    </div>

                    <div class="control-group1" style="width:100%;margin-left: 6%">
                        <div class="btn btn-primary" id="add_gaiban_mb" data-key="1">添加其他材料</div>
                    </div>
                    <foreach name='product_info' item='vo'  key="num">
                        <div class="form-group cailiao pro_{$num}" name='base'>
                            <div class='col-md-2 ' style='width: 20%;margin-left: 35px;'>
                                <input type='hidden' class="product_info_id_{$num}" name='other[{$num}][product_info_id]' value='{$vo.id}'>
                                <input type='hidden' class="dele_product_info_id_{$num}" name='other[{$num}][dele_product_info_id]' value=''>
                                <input type='hidden' name='other[{$num}][isort]' value='1'>
                                <input type='text' name='other[{$num}][iname]' style='width:100px;' class='form-control  iname'
                                       value='{$vo.iname}'>
                                <input type='text' name='other[{$num}][iwidth]' placeholder='宽' class='minwidth form-control iwidth'
                                       value='{$vo.iwidth}' style='margin-right:5px'>
                                <input type='text' name='other[{$num}][iheight]' placeholder='高' class='minwidth form-control iheight'
                                       value='{$vo.iheight}' style='margin-right:5px'>
                                <input type='text' name='other[{$num}][ithick]' placeholder='厚' class='minwidth form-control ithick' value='{$vo.ithick}'> mm
                            </div>
                            <div class='col-md-2 ' style='width: 15.9%'>
                                <label class='control-label w80'>材料种类：</label>
                                <div class='col-md-2  '>
                                    <select class="form-control  icate " name="other[{$num}][icate]">
                                        <volist name="cate_type" id="voc">
                                            <if condition="$vo.icate eq $voc.id">
                                                <option value="{$voc.id}" selected>{$voc.name}</option>
                                                <else/>
                                                <option value="{$voc.id}">{$voc.name}</option>
                                            </if>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class='col-md-2  ' style='width:13.5%'>
                                <label class='control-label w70'>数量：</label>
                                <div class='col-md-2  '>
                                    <input type='text' class='form-control inumber' name='other[{$num}][inumber]' style='width:100px;'
                                           value='{$vo.inumber}'>
                                </div>
                            </div>
                            <div class='col-md-2' style='width:13.5%'>
                                <label class='control-label w80'>材料价格：</label>
                                <div class='col-md-2  '>
                                    <input type='text' class='form-control imaterial_price' name='other[{$num}][imaterial_price]' style='width:100px;'
                                           value='{$vo.imaterial_price}'>
                                </div>
                            </div>
                            <div class='col-md-2  ' style='width:13.5%'>
                                <label class='control-label w80'>维修价格:</label>
                                <div class='col-md-2  '>
                                    <input type='text' class='form-control irepair_price' name='other[{$num}][irepair_price]' style='width:100px;'
                                           value='{$vo.irepair_price}'>
                                </div>
                            </div>
                            <div class='col-md-2 ' style='width:13.5%'>
                                <label class='control-label w80'>更换价格：</label>
                                <div class='col-md-2  '>
                                    <input type='text' class='form-control ichange_price' name='other[{$num}][ichange_price]' style='width:100px;'
                                           value='{$vo.ichange_price}'>
                                </div>
                            </div>
                            <div class='col-md-2  ' style='width:50px;'>
                                <div class='btn btn-primary del_gaiban' data-k="{$num}" data-info-id="{$vo.id}" >-</div>
                            </div>
                        </div>
                    </foreach>
                </div>
            </div>
        </fieldset>
        <!--</if>-->
        </fieldset>

        <div class="form-actions">
            <div class="btn btn-primary" id="check-ajax-submit">{:lang('ADD')}</div>
<!--            <button type="b" class="btn btn-primary js-ajax-submit" >{:lang('ADD')}</button>-->
            <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
        </div>
    </form>

</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script>
    var cate_id= "{$cate_id}";
    $(function () {
        var mbid = $('select[name="new_pro"]').val();
        if (cate_id==1){
            // A(product_id)
        }else if (cate_id==2){
            var info_id = $('select[name="product_info_id"]').val();
            var base_id = $('select[name="product_mb_base_id"]').val();
            var base_id1 = $('select[name="product_mb_base_id1"]').val();
            if (mbid){
                mb(mbid);
            }
        }else if (cate_id==3){
        }else if (cate_id==4){

        }
    })
    //切换分类
    $("#mb_id").change(function () {
        $("#footprint").val($(this).children('option:selected').attr("data-pro_length"));
        $("#tombstone_w").val($(this).children('option:selected').attr("data-pro_width"));
        $("#tombstone_h").val($(this).children('option:selected').attr("data-pro_height"));

    })

    $("#select_pro_id").change(function () {
        var mbid = $(this).val();
        if (cate_id==1){
            A(product_id)
        }else if (cate_id==2){
            mb(mbid);
        }else if (cate_id==3){
        }else if (cate_id==4){

        }
    })

    $('select[name=new_pro]').change(function () {
        var img_src=$(this).find('option:selected').data('photo_path');
        var img_url=$(this).find('option:selected').data('photo');
        $('#preview_path').attr('src',img_src)
        $('#tom_img').val(img_url)
    })
    $('select[name=old_pro]').change(function () {
        var img_src=$(this).find('option:selected').data('photo_path');
        var img_url=$(this).find('option:selected').data('photo');
        $('#preview_path').attr('src',img_src)
        $('#tom_img').val(img_url)
    })

    $('#design').change(function () {
        var cou = $('.push_add_mubs').length;
        var ij = $(this).val();
        console.log(cou)
        console.log(ij)
        for (var is = 0; is < cou; is++) {
            $('.dele_mb_id_'+is).val($('.info_mb_id_'+is).val())
        }
        $('.push_add_mubs').css('display','none');
            for (var i = 0; i < ij; i++) {
                if ($('.push_add_mubs').is('.add_'+i)){
                    $('.add_'+i).css('display','block');
                    $('.add_'+i).attr('data-mb_id');
                    $('.dele_mb_id_'+i).val('');
                }else {
                    var html='<div class="form-group push_add_mubs add_'+i+'" data-key="'+i+'">\n' +
                        '                        <input type="hidden" name="mb['+i+'][mb_id]" class="mb_id_'+i+'">\n' +
                        '                        <input type="hidden" name="mb['+i+'][regulation]" class="regulation_'+i+'">\n' +
                        '                        <label class="control-label" style="width: 150px">【<input type="text" name="mb['+i+'][mb_name]" value="定制墓碑1" class="mb_name_'+i+'" class="mb_name_1" style="width: 70px;border: 0">】</label>\n' +
                        '                        <label style="margin-left: 15px">位置：\n' +
                        '                            <input type="text" name="mb['+i+'][address]" style="width: 180px;" class="form-control" required>\n' +
                        '                        </label>\n' +
                        '                        <div class="btn btn-primary" style="margin-left: 30px">\n' +
                        '                            <a   data-mb_id="0"class="add_mub" id="add_mub_'+i+'" data-key="'+i+'">\n' +
                        '                                <span style="color: #fff">添加详细墓碑信息</span>\n' +
                        '                            </a>  \n' +
                        '                        </div>\n' +
                        '                        <div class="btn btn-danger" style="margin-left: 30px">\n' +
                        '                            <a     class="del_mub " data-key="'+i+'">\n' +
                        '                                <span style="color:#fff ">重置墓碑产品信息</span>\n' +
                        '                            </a>\n' +
                        '                        </div>\n' +
                        '                    </div>';
                    $('#mb').append(html);
                }
            }
    })
    $(document).on("click",".del_mub",function(){
        var pro_key = $(this).attr('data-key');
        var mb_id  = $('.mb_id_'+pro_key).val();
        layer.confirm("确认重置当前墓碑产品信息吗？重置后，重新填写内容。", {
            icon: 3,
            title: "提示", btn: ['是', '否']
            , btn1: function () {
                $.ajax({
                    url: "{:url('prodelete')}?type=1&id="+mb_id, type: "get",
                    async: true, traditional: true,
                    contentType: 'application/json',
                    success: function (json) {
                        if (json.code==1){
                            $('.mb_name_'+pro_key).val('');
                            $('.mb_id_'+pro_key).val('');
                            json.msg
                            layer.alert(json.msg)
                            layer.close(index);
                        }
                    }
                })
            }
        })
    })
    $(document).on("click",".add_mub",function(){
        console.log($(this).data('key'))
        var pro_key = $(this).attr('data-key');
        var mb_id  = $('.mb_id_'+pro_key).val()
        if (mb_id==0){
            var url = "{:url('Admin/Rock/productysmb')}?type="+pro_key;
        }else {
            var url = "{:url('Admin/Rock/productysmbedit')}?id=" + mb_id + "&type=" + pro_key;
        }

        console.log(url)
        $.ajax({
            url: url, type: "get",
            async:true,traditional: true,
            contentType : 'application/json',
            success: function (json) {
                layer.open({
                    type: 1 ,
                    title: '编辑墓碑详情',
                    area: ['98%', '90%'],
                    shadeClose: true,
                    shade: [0.001, '#000000'],
                    btn: ['确定', '取消'],
                    content: json,
                    yes: function(index, layero){
                        console.log(12)
                        var thedata = $('#form_horizontal_arr').serialize();
                        $.ajax({
                            url: url,
                            type: 'post',
                            data: thedata,
                            success: function (res) {
                                console.log(res)
                                if (res.code==0) {
                                    layer.msg(res.msg,{icon:3});
                                }else {
                                    $(this).attr('data-mb_id',res.data.pro_id)
                                    $('.mb_id_'+pro_key).val(res.data.pro_id)
                                    $('.mb_name_'+pro_key).val(res.data.pro_name)
                                    $('.regulation_'+pro_key).val(res.data.regulation)
                                    $('.add_mub_'+pro_key).attr('data-pro_id',res.data.pro_id)
                                    console.log(res)
                                    layer.close(index);
                                }
                            }
                        })
                    },
                });
            }
        })
    })

    function mb(id,info_id=0,base_id=0,base_id1=0){
        $.ajax({
            url		: "{:url('getProductMbInfo')}",
            type	: "post",
            dataType: "json",
            data	: {'id':id,'type': 2},
            success : function(result){
                if (result.data.product_info){
                    $('select[name="product_info_id"]').html('')
                    $.each(result.data.product_info  , function(i, n){
                        if (info_id==n.id){
                            $('select[name="product_info_id"]').append(' <option selected value="'+n.id+'">'+n.iname+'</option>')
                        } else {
                            $('select[name="product_info_id"]').append(' <option value="'+n.id+'">'+n.iname+'</option>')
                        }
                    })
                }else {
                    $('select[name="product_info_id"]').html('<option value="">请选择其他材料</option>')
                }
                if (result.data.product_mb_base){
                    $('select[name="product_mb_base_id"]').html('')
                    $('select[name="product_mb_base_id1"]').html('')
                    $.each(result.data.product_mb_base, function(i, n){
                        if (base_id = n.id){
                            $('select[name=product_mb_base_id]').append(' <option selected value="'+n.id+'">'+n.mb_name+'</option>')
                        }else {
                            $('select[name=product_mb_base_id]').append(' <option value="'+n.id+'">'+n.mb_name+'</option>')
                        }
                        if(base_id1 == n.id){
                            $('select[name=product_mb_base_id1]').append(' <option selected value="' + n.id + '">' + n.mb_name + '</option>')
                        }else {
                            $('select[name=product_mb_base_id1]').append(' <option value="' + n.id + '">' + n.mb_name + '</option>')
                        }
                    })
                }else {
                    $('select[name="product_mb_base_id"]').html('<option value="">请选择墓碑</option>')
                    $('select[name="product_mb_base_id1"]').html('<option value="">请选择墓碑</option>')
                }
            },
            error	: function(){
                alert("服务器内部错误，请联系系统管理员");
            }
        });
    }


    $("#select_pro_id").trigger("onchange")
    function A(obj){
        var id = obj.value;
        console.log(id)
        $.ajax({
            url		: "{:url('Visua/getProductInfo')}",
            type	: "post",
            dataType: "json",
            data	: {'id':id,'Ajax': 1},
            success : function(result){
                var html = getCommonHtml(result);
                $("div[name='proName']").html(html);
            },
            error	: function(){
                alert("服务器内部错误，请联系系统管理员");
            }
        });
    }
    //添加其他材料
    var catejson = {$cateJson};
    var catehtml = "";
         catehtml = "<option value=''>请选择材料种类</option>";
    $.each(catejson, function (i, n) {
        catehtml += "<option value='" + n.id + "'  data-stuff_money='"+n.stuff_money+"' data-action='"+n.stuff_unit+"'>" + n.name + "</option>";
    });

    $("#add_gaiban_mb").click(function () {
            var key =  $(this).attr('data-key');
            var str = "";
            str =
                "<div class='form-group cailiao' name='base'><div class='col-md-2  ' style='width: 20%;margin-left: 35px;'>" +
                "<input type='hidden' name='other["+key+"][product_info_id]' value=''>" +
                "<input type='hidden' name='other["+key+"][dele_product_info_id]' value=''>" +
                "<input type='hidden' name='other["+key+"][isort]' value='1' >" +
                "<input type='text' class='form-control ' name='other["+key+"][iname]' style='width:100px;' value=''>：" +
                "<input type='text' name='other["+key+"][iwidth]' placeholder='宽' class='minwidth form-control iwidth'  value='' style='margin-right:5px'>" +
                "<input type='text' name='other["+key+"][iheight]' placeholder='高' class='minwidth form-control iheight' value='' style='margin-right:5px'>" +
                "<input type='text' name='other["+key+"][ithick]' placeholder='厚' class='minwidth form-control ithick' value=''> mm" +
                "</div>" +
                "<div class='col-md-2' style='width: 15.9%'>" +
                "<label class='control-label w80' >材料种类：</label>" +
                "<div class='col-md-2'>" +
                "<select class='form-control icate' name='other["+key+"][icate]'>";
            str += catehtml;
            str += "</select>" +
                "</div>" +
                "</div>" +
                "<div class='col-md-2' style='width:13.5%'>" +
                "<label class='control-label w70 ' >数量：</label>" +
                "<div class='col-md-2'>" +
                "<input type='text' class='form-control inumber' name='other["+key+"][inumber]' style='width:100px;' value=''>" +
                "</div>" +
                "</div>" +
                "<div class='col-md-2' style='width:13.5%'>" +
                "<label class='control-label w80'>材料价格：</label>" +
                "<div class='col-md-2'>" +
                "<input type='text' class='form-control imaterial_price' name='other["+key+"][imaterial_price]' style='width:100px;' value=''>" +
                "</div>" +
                "</div>" +
                "<div class='col-md-2' style='width:13.5%' >" +
                "<label class='control-label w80'>维修价格：</label>" +
                "<div class='col-md-2'>" +
                " <input type='text' class='form-control irepair_price' name='other["+key+"][irepair_price]' style='width:100px;' value=''>" +
                "</div>" +
                "</div>" +
                "<div class='col-md-2'  style='width:13.5%'>" +
                "<label class='control-label w80'  >更换价格：</label>" +
                "<div class='col-md-2'>" +
                "<input type='text' class='form-control ichange_price' name='other["+key+"][ichange_price]' style='width:100px;' value=''>" +
                "</div>" +
                "</div>" +
                "<div class='col-md-2' style='width: 50px'>" +
                "<div class='btn btn-primary del_gaiban'  >-</div>" +
                "</div></div>";
            $(this).parent("div").after(str);
            $(this).attr('data-key',parseInt(key)+1)

        });

    $(document).on('click',".del_gaiban",function(){
        console.log($(this).parent().parent().remove())
        $(this).parent().parent(".ailiao").remove();
    })
    $(document).on('blur',".iwidth",function(){
        var obj = $(this).closest('.cailiao');
        price_count(obj)
    });
    $(document).on('blur',".iheight",function(){
        var obj = $(this).closest('.cailiao');
        price_count(obj)
    });
    $(document).on('blur',".ithick",function(){
        var obj = $(this).closest('.cailiao');
        price_count(obj)
    });
    $(document).on('blur',".imaterial_price",function(){
        var obj = $(this).closest('.cailiao');
        price_count(obj)
    })
    // 主要
    $(document).on('change',".icate",function(){
        var obj = $(this).closest('.cailiao');
        var stuff_money = obj.find('.icate').children('option:selected').data('stuff_money');
        obj.find('.imaterial_price').val(stuff_money)
        price_count(obj)
    });

    var price_count = function(obj){
        var iwidth = obj.find('.iwidth').val()/1000,
            iheight = obj.find('.iheight').val()/1000,
            ithick = obj.find('.ithick').val()/1000,
            imaterial_price =  obj.find('.imaterial_price').val();
        console.log(iwidth)
        console.log(iheight)
        console.log(ithick)
        var change_price = 0;
        if(iwidth != '' && iheight !='' && ithick !=''  && imaterial_price != ''){
            change_price = iwidth*iheight*ithick*imaterial_price;
            change_price = change_price.toFixed(2);
        }
        obj.find(".ichange_price").val(change_price);
    };

    // 提交订单
    $("#check-ajax-submit").click(function(){
        $.post($("#ajax-form").attr('action'), $("#ajax-form").serialize(), function(result){
            if(result.code == 1){
                layer.alert('提交成功。', {icon: 1, yes: function (index) {
                        layer.close(index);
                        window.location.href = result.url;
                    }})
            } else {
                layer.msg(result.msg);
            }
        }, 'json');
    });

</script>
